﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Common.OjbectPool
{
   public  class BaseObjectPool<T> : IObjectPool<T>
    {
        private volatile Boolean closed;
        public T BorrowObject()
        {
            throw new NotImplementedException();
        }

        public void ReturnObject(T obj)
        {
            throw new NotImplementedException();
        }

        public void InvalidateObject(T obj)
        {
            throw new NotImplementedException();
        }

        public void AddObject()
        {
            throw new NotImplementedException();
        }

        public int GetNumIdle()
        {
            return -1;
        }

        public int GetNumActive()
        {
            return -1;
        }

        public void Clear()
        {
            throw new NotImplementedException();
        }

        public Boolean IsClosed()
        {

            return closed;

        }

        public void Close()
        {
            closed = true;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <exception cref="IllegalStateException"></exception>
        protected void AssertOpen()
        {
            if (IsClosed())
            {
                throw new IllegalStateException("Pool not open");
            }
        }


        public T BorrowObject(long maxWaitMillis)
        {
            throw new NotImplementedException();
        }

        public void Dispose()
        {
            Close();
        }
    }
}
